Fix MSTest live output deadlock#10169
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 893d0fed-d2f1-4c47-a0e8-9648c457af66
There was a problem hiding this comment.
Pull request overview
Fixes MSTest live-output deadlocks by separating live echoes from the captured console writer.
Changes:
- Adds a synchronized, auto-flushing standard-output writer without encoding preambles.
- Routes
TestContextand trace live output through the dedicated writer. - Adds a deterministic lock-inversion regression test.
Show a summary per file
| File | Description |
|---|---|
UnitTestRunner.cs |
Creates and configures the dedicated live-output writer. |
InternalAPI.Unshipped.txt |
Tracks the new internal writer factory. |
ConsoleRouterTests.cs |
Verifies deadlock prevention and writer behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Medium
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 893d0fed-d2f1-4c47-a0e8-9648c457af66
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 893d0fed-d2f1-4c47-a0e8-9648c457af66
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/ConsoleRouterTests.cs:268
- As in the other regression test, restoring the live writer to
previousConsoleOutcorrupts the install-once routing state when that value is already the console router. A later live-output context can then use the captured writer and regain the lock inversion. Preserve and restore the exact previous live writer instead of deriving it fromConsole.Out.
TestContextImplementation.ConfigureLiveOutputWriter(previousConsoleOut);
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Medium
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 893d0fed-d2f1-4c47-a0e8-9648c457af66
🧪 Test quality grade — PR #10169
This advisory comment was generated automatically. Grades are heuristic Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/backport to rel/4.3 |
|
Started backporting to rel/4.3: https://github.com/microsoft/testfx/actions/runs/30012136008 |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Patch format detection failed.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
17 similar comments
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
@Evangelink backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --continue
fatal: Resolve operation not in progress, we are not resuming.
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
|
Potential infinite loop guard hit. Stopping |
Update MSTest and Microsoft.Testing.Platform to TestFX build 324182, which includes microsoft/testfx#10169, and re-enable live capture in CI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8bf6402b-2114-4555-97d4-9708f64b60da
Summary
TestContextand trace live echoes through a dedicated synchronized writer over standard outputConsole.Outlock inversion and verifies concurrent writes complete with the dedicated writerRoot cause
Linux Helix dumps from dotnet/sdk showed
TestContextImplementation.WriteLiveholding the originally captured synchronized writer whileConsolePal.WriteFromConsoleStreamwaited for the currentConsole.Out. Concurrently, the console logger held the currentConsole.Outwriter whileConsoleRouterwaited for the captured writer. This opposing lock order deadlocked all live-output writers.The dedicated writer removes the captured writer from the
TestContextand trace paths. Console stdout/stderr routers retain their existing captured-writer behavior, preservingNone,Result,Live, redirection, and install-once semantics without introducing the inverse lock order.Unblocks dotnet/sdk#55418.
Validation
ConsoleRouterTests: 10/10 passedOutputCaptureModeTestsacceptance suite: 14/14 passed